package com.fuze.energy.controller;

import com.fuze.energy.common.Result;
import com.fuze.energy.service.HumidityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author sepc_
 * @date 7/30/2021 09:06
 * 湿度相关API
 */
@Api(tags = "湿度API")
@Slf4j
@RestController
@RequiredArgsConstructor
public class HumidityController {

    final HumidityService humidityService;

    @ApiOperation(value = "根据主板Id查询当前环网柜湿度")
    @GetMapping("/hum/current/{mainBoardId}")
    public Result currentHum(@PathVariable(name = "mainBoardId") String mainBoardId) {
        Double currentHum = humidityService.currentHum(mainBoardId);
        return Result.ok(currentHum);
    }

    @ApiOperation(value = "根据主板Id查看今日环网柜湿度")
    @GetMapping("/hum/today/{mainBoardId}")
    public Result todayHum(@PathVariable(name = "mainBoardId") String mainBoardId) {
        List<List<String>> result = humidityService.todayHum(mainBoardId);
        return Result.ok(result);
    }

}
